package com.zhkj.crawl.rank.ext;

import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;

@Slf4j
public class ChromePaypal extends BaseChromeOpt{
    private static final String accounts = "sanoleamovo18@gmail.com:zzz@159357\n" +
            "doshiscotch84@gmail.com:zzz@159357\n" +
            "usselguillko47@gmail.com:zzz@159357\n" +
            "carusglennwg60@gmail.com:zzz@159357\n" +
            "crothrolfgz79@gmail.com:zzz@159357\n" +
            "gellenolanqw22@gmail.com:zzz@159357\n" +
            "skeltjeronip70@gmail.com:zzz@159357\n" +
            "waldocydneoe42@gmail.com:zzz@159357\n" +
            "hobsoeiraby42@gmail.com:zzz@159357\n" +
            "manthjulesoe70@gmail.com:zzz@159357\n" +
            "mazzabinduwm92@gmail.com:zzz@159357\n" +
            "emamrodnewo95@gmail.com:zzz@159357\n" +
            "guysuzetvn91@gmail.com:zzz@159357\n" +
            "obrecpablokx34@gmail.com:zzz@159357\n" +
            "caryrydmaxe84@gmail.com:zzz@159357\n" +
            "dietsarviddj71@gmail.com:zzz@159357s\n" +
            "redmaryleyrf65@gmail.com:zzz@159357\n" +
            "hustejonahac11@gmail.com:zzz@159357\n" +
            "zeinlilahwb19@gmail.com:zzz@159357\n" +
            "elberwalteiq60@gmail.com:zzz@159357\n" +
            "vanstderribj32@gmail.com:zzz@159357\n" +
            "winghelmuqm58@gmail.com:zzz@159357\n" +
            "kokkoloanndx22@gmail.com:zzz@159357\n" +
            "riekejieyicg65@gmail.com:zzz@159357\n" +
            "kilpanormawh27@gmail.com:zzz@159357\n" +
            "pletckelenae40@gmail.com:zzz@159357\n" +
            "florakennynr64@gmail.com:zzz@159357\n" +
            "ghentblasya31@gmail.com:zzz@159357\n" +
            "parismanisqh34@gmail.com:zzz@159357\n" +
            "seltzveledpz28@gmail.com:zzz@159357\n" +
            "kochwilllgn39@gmail.com:zzz@159357\n" +
            "trombyaffacb38@gmail.com:zzz@159357\n" +
            "treecmarkfp26@gmail.com:zzz@159357\n" +
            "peluschengsm80@gmail.com:zzz@159357\n" +
            "neilelbergq70@gmail.com:zzz@159357\n" +
            "waldrichaio21@gmail.com:zzz@159357\n" +
            "galluriccacy96@gmail.com:zzz@159357\n" +
            "panthimogecn30@gmail.com:zzz@159357\n" +
            "patilmerlecs97@gmail.com:zzz@159357\n" +
            "cuylelynnrb67@gmail.com:zzz@159357\n" +
            "boeskelsevu60@gmail.com:zzz@159357\n" +
            "pateljosephine8xp@gmail.com:zhFGg@1314\n" +
            "robinsonopal61im@gmail.com:zhFGg@1314\n" +
            "v03alvarezindia@gmail.com:zhFGg@1314\n" +
            "gutierrezanne56hp@gmail.com:zhFGg@1314\n" +
            "patellucca34vu@gmail.com:zhFGg@1314\n" +
            "ramirezvalentino51s@gmail.com:zhFGg@1314\n" +
            "ortizroyce38q@gmail.com:zhFGg@1314\n" +
            "eleanorcook4u@gmail.com:zhFGg@1314\n" +
            "1049705180@qq.com:qian951210";

    public static void main(String[] args) {
        enter();
    }

    private static void enter(){
        ChromeDriver driver = initDriver(true);
        try {
            String loginUrl = "https://www.ip.cn/api/index?ip=&type=0";
            toPage(driver, loginUrl);

//            for (String s : accounts.split("\n")) {
//                String loginUrl = "https://www.paypal.com/signin";
//                toPage(driver, loginUrl);
//                optLogin(driver, s);
//                break;
//            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
//            driver.quit();
        }

    }

    private static void optLogin(ChromeDriver driver, String account) throws InterruptedException {
        String[] split = account.split(":");
        // 填写账密
        driver.findElementById("email").sendKeys(split[0]);
        WebElement btnNext = null;
        try { btnNext = driver.findElementById("btnNext");
        }catch (Exception e){ }

        if(btnNext != null && btnNext.isDisplayed()){
            btnNext.click();
            sleep(5);
        }
        driver.findElementById("password").sendKeys(split[1]);
        driver.findElementById("btnLogin").click();

    }


}
